load("//tools/build_defs/oss:rn_defs.bzl", "KEYSTORE_TARGET", "react_native_dep", "react_native_integration_tests_target", "react_native_target", "rn_android_binary")

# We are running instrumentation tests in simple mode: app code and instrumentation are in the same APK
# Currently you need to run these commands to execute tests:
#
# node cli.js bundle --platform android --dev true --entry-file ReactAndroid/src/androidTest/js/TestBundle.js --bundle-output ReactAndroid/src/androidTest/assets/AndroidTestBundle.js
# gradle :ReactAndroid:packageReactNdkLibsForBuck
# buck install ReactAndroid/src/androidTest/buck-runner:instrumentation-tests
# ./scripts/run-android-instrumentation-tests.sh com.facebook.react.tests
rn_android_binary(
    name = "instrumentation-tests",
    keystore = KEYSTORE_TARGET,
    manifest = "AndroidManifest.xml",
    use_split_dex = True,
    deps = [
        react_native_dep("libraries/soloader/java/com/facebook/soloader:soloader"),
        react_native_dep("third-party/java/testing-support-lib:exposed-instrumentation-api"),
        react_native_integration_tests_target("assets:assets"),
        react_native_integration_tests_target("java/com/facebook/react/tests:tests"),
        react_native_target("java/com/facebook/react/devsupport:devsupport"),
        react_native_target("jni/prebuilt:android-jsc"),
        react_native_target("jni/prebuilt:reactnative-libs"),
    ],
)
